/**
 * Copyright Sp42 frank@ajaxjs.com Licensed under the Apache License, Version
 * 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
 * or agreed to in writing, software distributed under the License is
 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package com.ajaxjs.net.mail;

import lombok.Data;

/**
 * 邮件模型
 *
 * @author sp42 frank@ajaxjs.com
 */
@Data
public class Mail {
    private String mailServer;

    private String from;

    private String to;

    private String content;

    private String account;

    private String password;

    private String subject;

    private boolean isHTML_body;

    private int port = 25;

    public String getMailServer() {
        if (mailServer == null)
            throw new IllegalArgumentException("没有指定 MailServer！");

        return mailServer;
    }

    public String getFrom() {
        if (from == null)
            throw new IllegalArgumentException("没有指定发件人！");

        return from;
    }

    public String getTo() {
        if (to == null)
            throw new IllegalArgumentException("没有指定收件人！");

        return to;
    }

    public boolean isHTML_body() {
        return isHTML_body;
    }

    public void setHTML_body(boolean isHTML_body) {
        this.isHTML_body = isHTML_body;
    }

}
